package com.tedu.bill.homework2;

/**
 * Author：毕龙
 * Date: 2024/3/28 19:10
 */
public class TestQuestion9 {
    public static void main(String[] args) {
        /**
         * 100 - 999
         * 求出每个位置上的数字
         * 阶乘函数
         */
        for (int i = 100; i <= 999; i++) {
            if( (factorial(i%10) + factorial(i /10 %10) + factorial(i/100)) == i  ){
                System.out.println(i);
            }
        }
    }

    //阶乘
    public static int factorial(int n){
        //判断出口条件
        if(n == 1 || n == 0) return 1;
        //递归
        return n * factorial(n-1);
    }
}
